Try out status-key option
authorjustbur <justin@burkett.cc>
Fri, 10 Jul 2015 00:46:49 +0000 (20:46 -0400)
committerjustbur <justin@burkett.cc>
Fri, 10 Jul 2015 00:46:49 +0000 (20:46 -0400)
which-key.el

index cbc3a2b87b177100fe458c5d7d7346f495fd122c..c03954518006cef14e5852190c861a0c9c5e6351 100644 (file)
@@ -569,14 +569,17 @@ the maximum number of lines availabel in the target buffer."
 (defun which-key/populate-buffer (prefix-keys formatted-keys
                                   column-width sel-win-width)
   "Insert FORMATTED-STRINGS into which-key buffer, breaking after BUFFER-WIDTH."
-  (let* ((vertical-mode (member which-key-side-window-location '(left right)))
+  (let* ((vertical-mode (and (eq which-key-popup-type 'side-window)
+                             (member which-key-side-window-location '(left right))))
+         (n-status-key 1)
+         (which-key-show-prefix nil)
          (prefix-w-face (which-key/propertize-key prefix-keys))
          (prefix-len (+ 2 (length (substring-no-properties prefix-w-face))))
          (prefix-string (when which-key-show-prefix
                           (if (eq which-key-show-prefix 'left)
                               (concat prefix-w-face "  ")
                             (concat prefix-w-face "-\n"))))
-         (n-keys (length formatted-keys))
+         (n-keys (+ n-status-key (length formatted-keys)))
          (max-dims (which-key/popup-max-dimensions sel-win-width))
          (max-height (when (car max-dims) (car max-dims)))
          (max-width-for-columns (if (cdr max-dims)
@@ -590,11 +593,18 @@ the maximum number of lines availabel in the target buffer."
                       n-columns))
          (act-width (+ (* n-columns column-width)
                        (if (eq which-key-show-prefix 'left) prefix-len 0)))
-         ;; (avl-lines/page (which-key/available-lines))
          (max-keys/page (when max-height (* n-columns max-height)))
          (n-pages (if (> max-keys/page 0)
                       (ceiling (/ (float n-keys) max-keys/page)) 1))
+         (n-keys-pg1 (- (if (= 1 n-pages) n-keys max-keys/page) n-status-key))
+         (count (format "-  [%s/%s]" n-keys-pg1 (- n-keys n-status-key)))
+         ;; (count-len (length count))
+         (status-key (concat prefix-keys count))
+         (status-key (s-pad-right column-width " " status-key))
+         (status-key (propertize status-key 'face 'font-lock-comment-face))
+         (fmtd-keys (if (= 1 n-status-key) (push status-key formatted-keys) formatted-keys))
          pages act-height first-page)
+    (message "%s" status-key)
     (if (and (> n-keys 0) (> n-columns 0))
         (progn
           (dotimes (p n-pages)